C-Level Extensibility > The C-level extensibility API > JSBool JS_ValueToInteger()

 

JSBool JS_ValueToInteger()

Description

Extracts a function argument from a jsval, converts it to an integer (if possible), and passes the converted value back to the caller.

Arguments

JSContext *cx, jsval v, long *lp

cx is the opaque JSContext pointer that was passed to the JavaScript function.
v is the jsval from which the string is to be extracted.
lp is a pointer to a 4-byte-long integer. This function stores the converted value in *lp.

Returns

A Boolean value indicating success (JS_TRUE) or failure (JS_FALSE).